<?php

namespace App\Http\Controllers\Home;

use Illuminate\Http\Request;
use DB;
use App\Http\Requests;
use App\Http\Controllers\Controller;

class IndexController extends Controller
{
	public function index(){
		
        //查询展示商品
        $showgoods1=DB::table('showgoods')->where('shid','=',1)->get();
        $showgoods2=DB::table('showgoods')->where('shid','=',2)->get();
        $showgoods3=DB::table('showgoods')->where('shid','=',3)->get();
        $showgoods4=DB::table('showgoods')->where('shid','=',4)->get();
        $showgoods5=DB::table('showgoods')->where('shid','=',5)->get();
        $showgoods6=DB::table('showgoods')->where('shid','=',6)->get();
        //
        $goods1=DB::table('goods')->where('tid','=',1)->take(8)->get();
        $goods2=DB::table('goods')->where('tid','=',2)->take(8)->get();
        $goods3=DB::table('goods')->where('tid','=',3)->take(8)->get();
        $goods4=DB::table('goods')->where('tid','=',4)->take(8)->get();
        $goods5=DB::table('goods')->where('tid','=',5)->take(8)->get();
        $goods6=DB::table('goods')->where('tid','=',6)->take(8)->get();
        $lunbo=DB::table('lunbo')->get();
        //显示网站首页(带数据)
	    return view('home.index',['goods1' => $goods1,
                                    'goods2' => $goods2,
                                    'goods3' => $goods3,
                                    'goods4' => $goods4,
                                    'goods5' => $goods5,
                                    'goods6' => $goods6,
                                    'showgoods1' => $showgoods1,
                                    'showgoods2' => $showgoods2,
                                    'showgoods3' => $showgoods3,
                                    'showgoods4' => $showgoods4,
                                    'showgoods5' => $showgoods5,
                                    'showgoods6' => $showgoods6,
                                    'lunbo' => $lunbo
        ]);
   }
	
	
	
	
   
   public function cart(){
	   //跳转到购物车
	   return view('home.cart');
   }
   
   
}
